@echo off
for /f "delims=" %%i in ('dir /a:-d /b /s *.avi') do ( 
	
	SETLOCAL ENABLEDELAYEDEXPANSION

	set folder=%%~pi
	set folder2=%%~nxi
	
	set folder=!folder:~,-1!
	
	call echo folder: %%folder%%
	
	for %%j in (!folder!) do (
		echo %%~nxj
		copy "%%i" ".\CopyFolder\%%~nxj.avi"
	) 
)
